POV-Ray : Newsgroups : povray.advanced-users : Beeing stupid... y=x*sin(1/x), how to? : Re: Beeing stupid... y=x*sin(1/x), how to? Server Time
30 Jul 2024 06:30:38 EDT (-0400)
  Re: Beeing stupid... y=x*sin(1/x), how to?  
From: Matt Giwer
Date: 15 Dec 1999 17:53:49
Message: <385845FC.F5F68C0E@ij.net>
Mario Splivalo wrote:

> Anyone, please, i'd love to plot a graph of the function, well, it's like
> this:
>
> I have y = x * sin(1/x), and its some graph in 2D, Well, now i want to
> rotate that graph around the z-axe (one pointing up/down), and represent
> that in POV. Is that possible withouht 3rd party programs/utils?

    2D plot

#declare i = .001 ;
#declare inc = 10 ;

#while (i<inc)
sphere { 0.0, .005 translate <i,i*sin(2*pi/i),0>
texture{pigment {radial frequency 8} finish{specular 1}} }

#declare i = i + 1/1000 ;
#end

And a 3D version if interested

#declare i = .001 ;
#declare inc = 10 ;

#while (i<inc)
sphere { 0.0, .005 translate <i,i*sin(2*pi/i),i*cos(2*pi/i)>
texture{pigment {radial frequency 8} finish{specular 1}} }

#declare i = i + 1/1000 ;
#end

    Take the 2D version out to some value of x and then bring it back to zero
along i*sin(2*pi/i)+.00001 or a larger number if you want a noticable
thickness.

    But instead of plotting it, write the x and y values to a file, search on
File I/O to learn that. Then import the file and tag it as a surface of
rotation, SOR.

    Should work.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.